function init() {
    vicPreHandle();
    vicAddEvent();
    // viconload();
}
//事件绑定
function vicAddEvent() {
    //这罩层事件
    //遮罩层的隐藏事件
    //拨打电话
    $(".vicBmUrl").on("touchend", function() {
        $(this).hide();
    });
    $(".vicMaskCall").on("touchend", function() {
        $(this).hide();
    });
    //立即参团
    $(".vicMaskJoin").on("touchend", function() {
        $(this).hide();
    });
    //分享
    $(".vicShare").on("touchend", function() {
        $(this).hide();
    });
    //点击赚 去支付
    $("#vicGoPay.vicMaskAlert,#vicGoPay.vicMaskAlert>.vicMaskPayAlert").on("touchend", function() {
        $("#vicGoPay.vicMaskAlert").hide();
    });
    //点击赚 去报名
    $("#vicGoIn.vicMaskAlert,#vicGoIn.vicMaskAlert>.vicMaskPayAlert").on("touchend", function() {
        $("#vicGoIn.vicMaskAlert").hide();
    });
    //点击赚 二维码
    $(".vicMaskEWM").on("touchend", function() {
        $(".vicMaskEWM").hide();
    });

    //阻止冒泡
    $(".MC,.MC>*").on("touchend", function(e) {
        e.stopPropagation();
    });

    //低栏电话按钮
    $(".vicPhone").on("touchend", function() {
        $(".vicMaskCall").show();
    });
    //点亮星星面板 立即点亮按钮
    $(".vicStars>.btn").on("touchend", function() {
        $(".vicShare").show();
    });
    $(".vicJQ").on("touchend", function() {
        console.log('vicJQ');
        $(".vicBmUrl").show();
    });
    forNeed();

}
//页面与处理
function vicPreHandle() {
    $(".vicFixed").css({ display: "block" });
    //	$(".vicMaskJoin").hide();
    //	$(".vicMaskCall").hide();

    function animation1() {
        var $lis = $(".scrollmsg>li");
        var count = $lis.length;
        var h = 53;
        var perMove = 100;
        var step = 1;
        $lis.each(function(index, elem) {
            $(elem).css({ top: index * h + "px" });
        });

        function moveUp() {
            var $lis = $(".scrollmsg>li");
            $lis.each(function(index, elem) {
                var curTop = parseInt($(elem).css("top"));

                curTop -= step + 1;
                if (curTop <= -h) {
                    curTop = (count - 1) * h;
                }

                $(elem).css("top", curTop + "px")
            });
        };
        setInterval(moveUp, perMove);
    }

    function animation2() {
        var $lis = $("ul.vicMsg>li");
        var count = $lis.length;
        var perHeight = 45;
        var totalH = 0;
        var time = 2500;
        var animationDuration = 2500;
        $lis.css({ opacity: "0" });
        $lis.each(function(index, elem) {
            setTimeout(function() {
                $(elem).animate({ opacity: "1" }, animationDuration / 5, "linear", function() {})
                    .animate({ opacity: "1" }, animationDuration / 5 * 3)
                    .animate({ opacity: "0" }, animationDuration / 5, "linear", function() {})
                    .animate({ opacity: "0" }, animationDuration / 5, "linear", function() {});
                setInterval(function() {
                    $(elem).animate({ opacity: "1" }, animationDuration / 5, "linear", function() {})
                        .animate({ opacity: "1" }, animationDuration / 5 * 3)
                        .animate({ opacity: "0" }, animationDuration / 5, "linear", function() {})
                        .animate({ opacity: "0" }, animationDuration / 5, "linear", function() {});
                }, count * time);
            }, index * time)
        });
    }
    /*function play(id){
    				var player = document.getElementById(id);
    				var pause = false;
    				return function () {
    					pause = !pause;
    						console.log(player);
    					if(pause){//播放
    						player.pause();
    						$(".vicMusic").removeClass("vicCWRotate360");
    					}else{//暂停
    						player.play();
    						$(".vicMusic").addClass("vicCWRotate360");
    						
    					}
    				}
    }
    function audioAutoPlay(id){  
    				    var audio = document.getElementById(id);  
    				    document.addEventListener("WeixinJSBridgeReady", function () {  
    				            audio.play();
    				    }, false);  
    				    document.addEventListener('YixinJSBridgeReady', function() {  
    				        audio.play();  
    				    }, false);  
    				}  */
    animation1();
    animation2();
    //audioAutoPlay('index_audio'); 
    //$(".vicMusic").on("touchend",play("index_audio"));
}
